home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
scroll
/
scroll.frm
< prev
next >
Wrap
Text File
|
1995-12-05
|
4KB
|
142 lines
VERSION 2.00
Begin Form ScrollDemo
Caption = "Scrolling Demo"
ClientHeight = 5205
ClientLeft = 1215
ClientTop = 1545
ClientWidth = 7170
Height = 5610
Icon = 0
Left = 1155
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 5205
ScaleWidth = 7170
Top = 1200
Width = 7290
Begin HScrollBar HScroll1
Height = 300
Left = 0
TabIndex = 1
Top = 4920
Width = 6885
End
Begin VScrollBar VScroll1
Height = 4935
Left = 6870
TabIndex = 0
Top = 0
Width = 300
End
Begin PictureBox Picture1
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
ForeColor = &H00000000&
Height = 4935
Left = 0
ScaleHeight = 329
ScaleMode = 3 'Pixel
ScaleWidth = 459
TabIndex = 2
Top = 0
Width = 6885
Begin PictureBox picture2
AutoSize = -1 'True
BackColor = &H000000FF&
BorderStyle = 0 'None
Height = 7200
Left = 0
Picture = SCROLL.FRX:0000
ScaleHeight = 480
ScaleMode = 3 'Pixel
ScaleWidth = 640
TabIndex = 3
Top = 0
Width = 9600
Begin CommandButton Command4
Caption = "Command4"
Height = 345
Left = 7140
TabIndex = 7
Top = 6600
Width = 1575
End
Begin CommandButton Command1
Caption = "Command1"
Height = 435
Left = 5160
TabIndex = 4
Top = 4440
Width = 1305
End
Begin CommandButton Command3
Caption = "Command3"
Height = 405
Left = 8310
TabIndex = 6
Top = 2880
Width = 975
End
Begin CommandButton Command2
Caption = "Command2"
Height = 345
Left = 990
TabIndex = 5
Top = 960
Width = 1545
End
End
End
End
Sub Form_Resize ()
' Repostioin scrollbars and parent picture control
VScroll1.Move ScaleWidth - VScroll1.Width, 0, VScroll1.Width, ScaleHeight - HScroll1.Height
HScroll1.Move 0, ScaleHeight - HScroll1.Height, ScaleWidth - VScroll1.Width
Picture1.Move 0, 0, VScroll1.Left, HScroll1.Top
' Enable or Disable VScroll1 depending on new size of Form
VScroll1.Value = 0 'Generates VScroll1_Change() event
VDiff = Picture1.ScaleHeight - Picture2.Height
VScroll1.Enabled = VDiff <= 0
If VScroll1.Enabled Then
VScroll1.Max = Abs(VDiff)
VScroll1.LargeChange = VScroll1.Max \ 10
End If
' Enable or Disable HScroll1 depending on new size of Form
HScroll1.Value = 0
HDiff = Picture1.ScaleWidth - Picture2.Width
HScroll1.Enabled = HDiff <= 0
If HScroll1.Enabled Then
HScroll1.Max = Abs(HDiff)
HScroll1.LargeChange = HScroll1.Max \ 10
End If
End Sub
Sub HScroll1_Change ()
' Picture.Left is set to the Negative of the value since
' as you scroll the Scrollbar to the Right, the display
' should move to the Left, showing more of the right
' of the display, and vice-versa when scrolling to the
' left
Picture2.Left = -HScroll1.Value
End Sub
Sub VScroll1_Change ()
' Picture.Top is set to the Negative of the value since
' as you scroll the Scrollbar down, the display
' should move up, showing more of the the bottom
' of the display, and vice-versa when scrolling up
Picture2.Top = -VScroll1.Value
End Sub